#ifndef MOUSECURSOR_H
#define MOUSECURSOR_H

#include <OgrePanelOverlayElement.h>
#include <OgreTexture.h>
#include <OgreMaterialManager.h>
#include <OgreOverlayManager.h>

class MouseCursor : public Ogre::Singleton<MouseCursor>
{
public:
	MouseCursor();
	~MouseCursor();

	struct Position
	{
		Position() {
			X = 0;
			Y = 0;
			normalisedX = 0.0f;
			normalisedY = 0.0f;
		}

		int X;
		int Y;
		float normalisedX;
		float normalisedY;
	};

	void setImage(const Ogre::String& filename);
	void setWindowDimensions(unsigned int width, unsigned int height);
	void setVisible(bool visible);
	void updatePosition(int x, int y);

	Position getPosition() { return position; };

	static MouseCursor& getSingleton(void);
	static MouseCursor* getSingletonPtr(void);

private:
	Ogre::Real clamp(Ogre::Real a, Ogre::Real min, Ogre::Real max);

	Ogre::Overlay* guiOverlay;
	Ogre::OverlayContainer* cursorContainer;
	Ogre::TexturePtr texture;
	Ogre::MaterialPtr material;
	Ogre::Real windowWidth;
	Ogre::Real windowHeight;
	Position position;
};

#endif